package com.taxi.driver.module.main.mine.message.details;

import com.qianxx.utils.RxUtil;
import com.socks.library.KLog;
import com.taxi.driver.common.BasePresenter;
import com.taxi.driver.data.user.UserRepository;

import javax.inject.Inject;


/**
 * Created by FTL
 */
public class MessageDetailsPresenter extends BasePresenter implements MessageDetailsContract.Presenter {

    private MessageDetailsContract.View mView;
    private UserRepository mUserRepository;

    @Inject
    public MessageDetailsPresenter(MessageDetailsContract.View view, UserRepository userRepository) {
        mView = view;
        mUserRepository = userRepository;
    }

    @Override
    public void subscribe() {

    }

    @Override
    public void unsubscribe() {
        super.unsubscribe();
    }

    @Override
    public void updateMsg(String uuid, int status) {
        mUserRepository.updateMsg(uuid, status)
                .compose(RxUtil.applySchedulers())
                .subscribe(entity -> mView.updateSuccess(),
                        KLog::e);
    }
}
